/*
 * Copyright (C) 2017-2021
 * All rights reserved, Designed By 深圳中科鑫智科技有限公司
 * Copyright authorization contact 18814114118
 */
package com.shop.cereshop.app.controller.recommend;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shop.cereshop.app.service.recommend.RecommendAtUserService;
import com.shop.cereshop.commons.domain.buyer.CereBuyerUser;
import com.shop.cereshop.commons.domain.buyer.FollowUserVo;
import com.shop.cereshop.commons.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;


/**
 * <p>
 * 前端控制器
 *
 * @author 罗霄
 * @用户表 </p>
 * @date 2025-08-25
 */
@Slf4j
@RestController
@RequestMapping("/recommendAtUser")
@Api(value = "RecommendAtUser", tags = "@用户表")
public class RecommendAtUserController {

    @Resource
    private RecommendAtUserService recommendAtUserService;

    /**
     * 获取最近@的人 好友 关注 列表
     */
    @GetMapping("getRecentAtUserList")
    @ApiOperation(value = "获取最近@的人 好友 列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "pageSize", value = "每页数量", required = true, dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "type", value = "1:最近@ 2:关注 3:好友 ", required = true, dataType = "Integer", paramType = "query"),
            @ApiImplicitParam(name = "name", value = "用户名称", required = false, dataType = "String", paramType = "query")
    })
    public Result<Page<FollowUserVo>> getRecentAtUserList(Integer pageNum, Integer pageSize, Integer type, String name, HttpServletRequest request) {
        CereBuyerUser user = (CereBuyerUser) request.getAttribute("user");
        Page<FollowUserVo> page = recommendAtUserService.getRecentAtUserList(pageNum, pageSize, type, name,user.getBuyerUserId());
        return Result.success(page);
    }

}
